<?php
require ('../include/init.inc.php');
$method = $module_id = '';
Template::assign ( 'content_header', $menu );
extract ( $_GET );

$modules = Card::getList($card_no,$open_phone,$start_time,$end_time);

$time = strtotime(date("Y-m-d",time()));
$statis = array();
for ($i=0; $i < 90; $i++) { 
	$statis[date("Y-m-d",$time+60*60*24*$i)." 00:00:00"]=0;
}
foreach ($modules as $key => $value) {
	if ($value["open_time"]) {
		$open_time = strtotime($value["open_time"]);
		for ($i=0; $i < $value["card_type"]; $i++) { 
			$statis[date("Y-m-d",$open_time+60*60*24*$i)." 00:00:00"]++;
		}	
	}
}
$display = array();
$phones = Phone::count();
foreach ($statis as $key => $value) {
	if ($value > $phones) {
		array_push($display, array('date' => $key,'value'=>$value ,'red'=>1));	
	} else {
		array_push($display, array('date' => $key,'value'=>$value ,'red'=>0));
	}
}
$confirm_html = OSAdmin::renderJsConfirm("icon-remove");
Template::assign ( 'modules', $display );
Template::assign ( '_GET', $_GET );
Template::assign ( 'osadmin_action_confirm' , $confirm_html);
Template::display ( 'panel/sms_static.tpl' );